package com.bangdream.michelia.view.adapter;


import android.text.format.DateUtils;
import android.widget.ImageView;

import com.bangdream.michelia.R;
import com.bangdream.michelia.entity.TrainPlanBean;
import com.bangdream.michelia.utils.DateUtil;
import com.bangdream.michelia.utils.ImageLoadUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

/**
 * Created by zhouyi on 2018/3/25.
 */

public class TrainPlanNewAdapter extends BaseQuickAdapter<TrainPlanBean, BaseViewHolder> {
    public TrainPlanNewAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, TrainPlanBean item) {
        TrainPlanBean.TrainingPlanBean bean = item.getTrainingPlan();
        if(bean!=null){
            helper.setText(R.id.tvTitle, bean.getTitle() + "");
            ImageLoadUtils.ImageLoad(mContext, bean.getCoverUrl(), (ImageView) helper.getView(R.id.ivIcon), -1);

            String beginTime = DateUtil.formart(bean.getBeginDate());
            String endTime = DateUtil.formart(bean.getEndDate());
            helper.setText(R.id.tvDate,"培训时间:"+beginTime+" 至 "+endTime);
        }

//        if (item.getLearnStatus() != null) {
//            viewHolder.tvState.setVisibility(View.VISIBLE);
//            viewHolder.tvState.setText(StausUtils.coursesStateToText(bean.getLearnStatus()));
//        } else {
//            viewHolder.tvState.setVisibility(View.GONE);
//        }
    }
}
